package top.jlzhou.jobs.controller;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.support.spring.annotation.ResponseJSONP;

import top.jlzhou.R;
import top.jlzhou.jobs.service.ClassInfoService;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author J.L.Zhou
 * @since 2018-10-22
 */
@Controller
//@RestController
@RequestMapping("/cls")
public class ClassInfoController {
	
	@Autowired
	private ClassInfoService service;

	@RequestMapping("list")
	@ResponseBody
	public Object doList() {
		return service.list(null);
	}
	
	@RequestMapping("list1")
	public void doList1(Map<String,Object> model) {
		model.put("list", service.list(null));
	}
//	public void doList1(Model model) {
//		model.addAttribute("list", service.list(null));
//	}
	

	@RequestMapping("list2")
	public String doList2(Map<String,Object> model) {
		model.put("list", service.list(null));
		
		
		return "/cls/list1";
//		request.getRequestDispatcher("/aa/bb.jsp").forward(request, response);
//		return "forward:/aa/bb.jsp";
//		response.sendRedirect("/aa/bb.jsp");
//		return "redirect:/aa/bb.jsp"
	}
	
	@RequestMapping("list3")
	public ModelAndView doList3() {
		ModelAndView view = new ModelAndView();
		view.addObject("list", service.list(null));
		view.setViewName("/cls/list1");
		return view;
	}
	
}

